local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"

if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
end

vim.cmd [[packadd packer.nvim]]

local startup = require("packer").startup

startup(
  function(use, _use_rocks)
	  -- package
	  use {"wbthomason/packer.nvim", opt = true}

	  -- treesitter
	  use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
    use "windwp/nvim-ts-autotag"
    use "p00f/nvim-ts-rainbow"

	  -- lsp
	  use "neovim/nvim-lspconfig"
    use "kabouzeid/nvim-lspinstall"
    use "nvim-lua/lsp-status.nvim"
    use { "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons"}
    use "glepnir/lspsaga.nvim"

	  -- cmp
	  use "hrsh7th/nvim-cmp"
	  use "hrsh7th/cmp-nvim-lsp"
	  use "hrsh7th/cmp-nvim-lua"
	  use "hrsh7th/cmp-path"
	  use "hrsh7th/cmp-buffer"
    use "L3MON4D3/LuaSnip"
    use "saadparwaiz1/cmp_luasnip"

	  -- filetree
	  use {'kyazdani42/nvim-web-devicons'}
	  use {'kyazdani42/nvim-tree.lua'}

    -- fuzzy
    use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } }

    -- comment
	  use "terrortylor/nvim-comment"
    use { "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim" }

    -- theme
	  use 'RRethy/nvim-base16'

    -- statusbar
    use { 'hoob3rt/lualine.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true} }
    use 'SmiteshP/nvim-gps'

    -- git
    use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } }

    -- other
    -- 自动保存
    use "Pocco81/AutoSave.nvim"
    -- tab 跳出作用域
    use {"abecodes/tabout.nvim"}
    -- http client
    use { 'NTBBloodbath/rest.nvim', requires = { 'nvim-lua/plenary.nvim' } }
  end
)
